<div class="row">
    <div class="col-md-12 col-xs-12" id="crumbs">
        <h2 class="title text-center">Tin tức</h2>
    </div>

    <div class="col-md-9 col-xs-12">
        <div class="row post-list">
            <div class="col-md-12 col-xs-12 mgt5">
                <div class="pull-right"><?php echo $pagingBar; ?></div>
            </div>
            <div class="clearfix"></div>

            <?php foreach($aPost as $post) { ?>
            <div class="post-list-item col-md-12 col-xs-12">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 row-title">
                        <div class="visible-xs">
                            <h3>
                                <a class="item-title clear-mgr clear-pad f16px" href="<?php echo post_single_url($post->getSlug()); ?>">
                                    <?php echo $post->getTitle(); ?>
                                </a>
                            </h3>
                            <p class="mgt5"><small>[<?php echo fdate_format($post->getCreatedAt(), 'Y-m-d'); ?>]</small></p>    
                        </div>
                        
                        <div class="col-md-5 col-xs-12 col-sm-12">
                            <div class="media">
                                <?php
                                $img_url = "";
                                if($post->getImage()!='' && image_exist('public/' . $post->image_folder . '/post/' . $post->getImage())) {
                                    $img_url = post_upload($post->getImage(), $post->image_folder);
                                } else {
                                    $img_url = "http://placehold.it/". urlencode('130x130&text=Hình đại diện');
                                }
                                ?>
                                <a class="thumbnail no-bdr" href="<?php echo post_single_url($post->getSlug()); ?>" title="<?php echo $post->getTitle(); ?>">
                                    <img class="post-item lazy" src="<?php echo assets('images/blank.gif', true); ?>" data-src="<?php echo $img_url; ?>" alt="<?php echo $post->getTitle(); ?>" />
                                </a>
                            </div>
                        </div>

                        <!--for xs-->
                        <div class="visible-md visible-lg col-md-7 col-xs-12 col-sm-12">
                            <div class="row-title">
                                <h4 class="clear-pad clear-mgr">
                                    <a class="item-title clear-pad f16px" href="<?php echo post_single_url($post->getSlug()); ?>"><?php echo $post->getTitle(); ?></a>
                                </h4>
                                <p class="mgt5"><small>[<?php echo fdate_format($post->getCreatedAt(), 'Y-m-d'); ?>]</small></p>
                            </div>
                        </div>
                        <!--#end for xs-->

                        <div class="mgt10 row-desc text-hyphens">
                            <?php echo substr($post->getDescription(), 0, 200); ?>...
                        </div>

                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
            <?php } ?>
        </div>
    </div>

    <div class="col-xs-12 col-md-3 mgt5">
        <?php
        $aSegment = $this->uri->segment_array();
        if(!isset($aSegment[2])){
            $aSegment[2] = '';
            $aSegment[3] = '';
        } else {
            if($aSegment[2]!='c'){
                $aSegment[3] = '';
            }
        }
        ?>
        <div class="list-group clear-radius">
            <?php foreach($aPostCate as $cate) { ?>
            <?php
            $active_class = '';
            $active_icon  = '';
            $active_link  = '#';
            if($aSegment[3]==$cate->getSlug()){
                $active_class = 'active';
                $active_icon = "<i class='glyphicon glyphicon-chevron-right'></i>&nbsp;";
            } else {
                $active_link = post_cate_url($cate->getSlug());
            }
            ?>
            <a class="list-group-item <?php echo $active_class; ?> clear-radius" href="<?php echo $active_link; ?>">
                <?php echo $active_icon . $cate->getTitle(); ?>
            </a>
            <?php } ?>
        </div>
    </div>
    <div class="clearfix"></div>
</div>